package com.demo.snowflake;

import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.IdUtil;

public class HutoolSnowflakeIdUtil {
    // 电脑id
    private static final Long WORKER_ID = 1L;
    // 机房id
    private static final Long DATACENTER_ID = 1L;

    public static String getNextID(Long workerID,Long dataCenterID) {
        Snowflake secondSnow = IdUtil.getSnowflake(workerID, dataCenterID);
        return secondSnow.nextIdStr();
    }

    public static String getNextID(){
        return getNextID(WORKER_ID, DATACENTER_ID);
    }
}
